package com.SpringMVC.PropertyEditor;

import com.SpringMVC.vo.User;

import java.beans.PropertyEditorSupport;

/**
 * 自定义属性转换器
 * 缺点：只能从String转换而来不能object转object
 */
public class UserPropertyEditor extends PropertyEditorSupport {
    @Override
    public void setAsText(String text) throws java.lang.IllegalArgumentException {
        User user = new User();
        user.setUsername(text);
        user.setId(1234);
        setValue(user);
    }
}
